{extend name="layout/layout" /}

{block name="navbar"}{/block}

{block name="style"}
	<style>
		body, .mui-content{
			background: #fff;
		}

		.mui-input-group:after{
			height: 0;
		}

	.con{
		padding: 15px;
	}
		.mui-input-group textarea{
			border:1px solid #ccc;
			padding: 5px;
			font-size: 12px;
		}

	</style>
{/block}

{block name="main"}
	<div class="login" v-cloak>
		<form class="mui-input-group">
			<div class="con">
				<textarea name="content" v-model="content" id="content" focuse cols="30" rows="10" placeholder="请填写反馈内容"></textarea>
			</div>
				<button class="mui-btn mui-btn-block mui-btn-theme" type="button" @tap="submitForm()">提交</button>

		</form>
	</div>
{/block}

{block name="script"}
	<script>

		var myVue = new Vue({
			el:'.login',
			data:{
				content: '',
			},
			mounted: function(){
				if(token){
					this.token = token;
				} else {
					this.login();
				}
			},
			methods: {
				login:function(){
					location.href = '/mobile/user/login';
				},
				submitForm:function(){
					if(!this.content) {
						mui.toast('请填写反馈内容');
						return;
					}

					var url =  'feedback/add';
					var that = this;
					layer.open({
						type:2,
						shadeClose:false,
						shade: 'background-color: rgba(0,0,0,.3)',
					});
					request(that, {'url': url, 'data': {content:that.content}}, function(res){
						layer.closeAll();
						mui.toast(res.msg);
						if(res.code == 200) {
							mui.back();
						}	
					});

				}
			}
		});
	</script>
{/block}